<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/temp.dwt" codeOutsideHTMLIsLocked="false" -->
<%@page import="com.crm.entity.Clientdet"%>
<%@page import="com.crm.entity.Opportunity,com.crm.beans.EnqSummary"%>
<%@page language="java" import="java.sql.*,java.util.*"%>
<%@page import="java.text.DateFormat"%>
<%@page import="java.text.SimpleDateFormat"%>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>ASCRM</title>
<link href="<%=application.getContextPath()%>/css/css-crm.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<%=application.getContextPath()%>/js/jquery-1.7.2.min.js"></script>
<%-- <script language="javaScript" src="<%=application.getContextPath()%>/js/jquery-ui-1.8.20.custom.min.js"></script> --%>
<script type="text/javascript" src="<%=application.getContextPath()%>/js/jquery-1.6.min.js"></script>	
<script type="text/javascript" src="<%=application.getContextPath()%>/js/jquery-ui-1.8.17.custom.min.js"></script>	
<link rel="stylesheet" href="<%=application.getContextPath()%>/css/jquery-ui-1.8.17.custom.css"/>
<script language="JavaScript" src="<%=application.getContextPath()%>/js/gen_validatorv4.js" type="text/javascript" ></script>
<script type="text/javascript" src="<%=application.getContextPath()%>/js/jquery.validate.js"></script>	
<script type="text/javascript" src="<%=application.getContextPath()%>/js/jquery.validate.min.js"></script>	

<link href="<%=application.getContextPath()%>/css/jquery-ui-1.8.17.custom.css" rel="stylesheet" type="text/css"/>
 

<script type="text/javascript">
function autoComplete(i) {
	var rowCount=$("#rowcount").val();
	var availTags=new Array();
	if(rowCount!=0 && rowCount!=1){
	for(i=1;i<rowCount;i++){
		//		alert($("#make"+i).val());
		availTags.push($("#make"+i).val());
	}}
    	$("input#make"+i).autocomplete({
    		source:availTags
		});
    	 jQuery('.ui-autocomplete').css({'font-size':'8px','font-family':'Arial','max-height': '100px',
    		'overflow-y': 'scroll', 'padding-right': '20px', 'overflow-x': 'hidden'}); 
    		
  }
function descAutoComplete(i) {
	var rowCount=$("#rowcount").val();
	var availTags=new Array();
	if(rowCount!=0 && rowCount!=1){
	for(i=1;i<rowCount;i++){
		//		alert($("#make"+i).val());
		availTags.push($("#desc"+i).val());
	}}
    	$("input#desc"+i).autocomplete({
    		source:availTags
		});
    	 jQuery('.ui-autocomplete').css({'font-size':'8px','font-family':'Arial','max-height': '100px',
    		'overflow-y': 'scroll', 'padding-right': '20px', 'overflow-x': 'hidden'}); 
    		
  }
  
     </script>
<script type="text/javascript">
function getDivision(org){
	if(org==null || org=='' || org=='Please Select') return;
var orgn=org.value;
//alert(orgn);
var data="orgn="+orgn;

$.ajax({
	url:" <%=application.getContextPath()%>/newEnq/getDiv.do",
	mimetype: "text/plain",
	method: "post",
	data: data,
	cache:false,
	success: function(res){
		var e2=document.getElementById('div');
		$('#div')
	    .find('option')
	    .remove()
	    .end()
	   	;
		//alert(res);
		var o=document.createElement('option');
		o.value="Please Select";
		o.text="Please Select";
		e2.options.add(o);
		if(res.length!=0){
		var temp=res.split(",");
		
		if(temp != null){
			for(var i=0;i<temp.length;i++){
				var o=document.createElement('option');
				o.value=temp[i];
				o.text=temp[i];
				e2.options.add(o);
			}
		}
		}
	}

});

}
</script>

<script>

	$(function() {
		$( "#datepicker" ).datepicker({ dateFormat: "dd-mm-yy" },"option", "autoSize", true);
	});
	</script>
	
	 <script type="text/javascript">
    $(document).ready(function(){
       $("#enqForm").validate({
    	   rules:{
    		   org: 
    			   "required",
    		   dDate: "required",
    		   user: "required",
    		  
    		   comp:"required",
    		 
    		   enqNum:"required",
    		   prob: {required: true, digits: true},
    		   eType:"required",
       
    		   div: "required",
    			   quotCurr: "required"
    	   },
       messages:{
    	   org: "Organisation must not be empty",
    	   dDate: "Due Date Must Not be empty",
    	   user: " User Name must not be Empty",
    	   div: "Division Must not Be empty",
    	   comp:"Company name must not be empty",
    	   opprName:"Opportunity Must not be empty",
    	   enqNum:"Enquiery Number must not be empty",
    	  prob:{
    		   required: "Probability must not be empty",
    		   digits: "Only Digits allowed for Probability"
    	   },
    	   projName:{
        	   required: "Telephone phone Number requred" 
           },
           eType:{
        	   required: "Enquiery Type Must requred"
           },
           quotCurr:"Currency must not be empty"
       }
       });
       });
    </script> 
	
<!-- <style >
.ui-dialog {
	
	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
	}
	
	
</style> -->
	
</head>

<body>
<%List<Opportunity> opprtlist =(List<Opportunity>)request.getAttribute("opprtunity");%>
<%List<EnqSummary> enqlist =(List<EnqSummary>)request.getAttribute("enqsum");%>
<div id="main" >
  <%  	Calendar currentDate = Calendar.getInstance();
		DateFormat formater = new SimpleDateFormat("yyyy-MM-dd");
		String dateNow = formater.format(currentDate.getTime());
        String datearr[]=dateNow.split("-");
        
         System.out.println("the current system month is"+datearr[1]);
         System.out.println("the current system year is"+datearr[0]);
        %>
  <!-- <div id="header"></div> -->
  <%--  <%@ include file="common/header.jsp" %> --%>
<%--   <%@ include file="common/submenu.jsp" %> --%>
  <div id="content">
   <div id="resultMsg" align="center" class="result_msg" >
    <% 
    	if(request.getParameter("refNo")!=null){
    		out.println(request.getParameter("refNo"));
    	}
 %>
    </div> 
    <div id="work-area">
      <div class="heading">Search by Parts</div>
	  
      <div class="boxdial">
        <form id="form1" name="form1" method="post" action="<%=application.getContextPath()%>/serach/getByPart.do">
          <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td align="right">&nbsp;</td>
              <td align="right" valign="middle">&nbsp;</td>
              <td align="right" valign="middle">&nbsp;</td>
              <td align="left" valign="middle">&nbsp;</td>
              <td align="left" valign="middle">&nbsp;</td>
              <td align="left" valign="middle">&nbsp;</td>
            </tr>
            <tr>
              <td width="17%" align="right"><strong>Search By Part</strong></td>
              <td width="26%" align="right" valign="middle"><label>
                <input name="partname" type="text" class="form" id="partid" />
              </label>              </td>
              <td width="8%" align="right" valign="middle">&nbsp;</td>
              <td width="17%" align="left" valign="middle"><input  type="checkbox" name="advanced" id="advanced" value="advanced"/><strong>Advanced Search</strong></td>
              <td width="10%" align="left" valign="middle">Month</td>
              <td width="14%" align="left" valign="middle"><select name="month"  class="form-smolest" id="month">
                <option value="01" <%if(datearr[1].equals("01")){ %>selected="selected"  <%} %> >Jan</option>
                <option value="02" <%if(datearr[1].equals("02")){ %>selected="selected"  <%} %> >Feb</option>
                <option value="03" <%if(datearr[1].equals("03")){ %>selected="selected"  <%} %>  >Mar</option>
                <option value="04" <%if(datearr[1].equals("04")){ %>selected="selected"  <%} %>  >Apr</option>
                <option value="05" <%if(datearr[1].equals("05")){ %>selected="selected"  <%} %>  >May</option>
                <option value="06" <%if(datearr[1].equals("06")){ %>selected="selected"  <%} %> >Jun</option>
                <option value="07" <%if(datearr[1].equals("07")){ %>selected="selected"  <%} %>  >Jul</option>
                <option value="08" <%if(datearr[1].equals("08")){ %>selected="selected"  <%} %>  >Aug</option>
                <option value="09" <%if(datearr[1].equals("09")){ %>selected="selected"  <%} %>  >Sep</option>
                <option value="10" <%if(datearr[1].equals("10")){ %>selected="selected"  <%} %>  >Oct</option>
                <option value="11" <%if(datearr[1].equals("11")){ %>selected="selected"  <%} %>  >Nov</option>
                <option value="12" <%if(datearr[1].equals("12")){ %>selected="selected"  <%} %>  >Dec</option>
                </select>
              </td>
              <td width="8%" align="center" valign="middle">year</td>
              <td width="17%" align="left" valign="middle">
               <select name="year" class="form-smolest" id="year">
                <option value="2012" <%if(datearr[0].equals("2012")){ %>selected="selected"  <%} %> >2012</option>
                <option value="2013" <%if(datearr[0].equals("2013")){ %>selected="selected"  <%} %>  >2013</option>
                <option value="2014"<%if(datearr[0].equals("2014")){ %>selected="selected"  <%} %>  >2014</option>
                <option value="2015" <%if(datearr[0].equals("2015")){ %>selected="selected"  <%} %>  >2015</option>
                <option value="2016" <%if(datearr[0].equals("2016")){ %>selected="selected"  <%} %>  >2016</option>
                <option value="2017"<%if(datearr[0].equals("2017")){ %>selected="selected"  <%} %>  >2017</option>
                <option value="2018"<%if(datearr[0].equals("2018")){ %>selected="selected"  <%} %>  >2018</option>
                <option value="2019"<%if(datearr[0].equals("2019")){ %>selected="selected"  <%} %>  >2019</option>
                <option value="2020"<%if(datearr[0].equals("2020")){ %>selected="selected"  <%} %>  >2020</option>
                <option value="2021"<%if(datearr[0].equals("2021")){ %>selected="selected"  <%} %>  >2021</option>
                <option value="2022"<%if(datearr[0].equals("2022")){ %>selected="selected"  <%} %>  >2022</option>
                <option value="2023"<%if(datearr[0].equals("2023")){ %>selected="selected"  <%} %>  >2023</option>
                <option value="2024"<%if(datearr[0].equals("2024")){ %>selected="selected"  <%} %> >2024</option>
              <option value="2025"<%if(datearr[0].equals("2025")){ %>selected="selected"  <%} %> >2025</option>
              </select>
              
                
                </td>
            </tr>
            <tr>
              <td align="right">&nbsp;</td>
              <td align="right" valign="top">&nbsp;</td>
              <td align="left" valign="middle">&nbsp;</td>
              <td align="left" valign="top">&nbsp;</td>
              <td align="left" valign="top">&nbsp;</td>
              <td align="left" valign="top">&nbsp;</td>
            </tr>
            
            <tr>
              <td align="right">&nbsp;</td>
              <td colspan="3" align="center" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td width="49%">&nbsp;</td>
                  <td width="51%"><input type="button" class="button" onclick="javascript: getSearchPart();" value="Search"/></td>
                </tr>
              </table></td>
              <td align="left" valign="top">&nbsp;</td>
              <td align="left" valign="top">&nbsp;</td>
            </tr>
            <tr>
              <td align="right">&nbsp;</td>
              <td colspan="3" align="center" valign="top">&nbsp;</td>
              <td align="left" valign="top">&nbsp;</td>
              <td align="left" valign="top">&nbsp;</td>
            </tr>
          </table>
        </form>
      </div>
	<%--   
	  <div class="box2">
        <table width="100%" border="0" cellpadding="4" cellspacing="1" bgcolor="#C5E4EB">
          <tr>
            <td width="36" align="center" valign="middle" background="images/table-box.jpg"  style="background-repeat:repeat-x">S.No </td>
            <td width="138" align="center" valign="middle" background="images/table-box.jpg"   style="background-repeat:repeat-xbgcolor="#FFFFFF">Reference Number</td>
            <td width="140" align="center" valign="middle" background="images/table-box.jpg"   style="background-repeat:repeat-xbgcolor="#FFFFFF"> Enquiry </td>
            <td width="162" align="center" valign="middle" background="images/table-box.jpg"  style="background-repeat:repeat-x bgcolor="#FFFFFF">Quotation</td>
            <td width="186" align="center" valign="middle" background="images/table-box.jpg"   style="background-repeat:repeat-xbgcolor="#FFFFFF">Purchase Order</td>
            <td width="186" align="center" valign="middle" background="images/table-box.jpg"   style="background-repeat:repeat-xbgcolor="#FFFFFF">Invoice</td>
          </tr>
             <%
              if(enqlist!=null){
	      	for(int i=0;i<enqlist.size();i++){ 
	      		System.out.println("the size of the pr list is "+enqlist.size());
	      	%>
          <tr>
            <td align="center" bgcolor="#FFFFFF"><%=enqlist.get(i).sno %></td>
            <td align="left" valign="top" bgcolor="#FFFFFF"><a  class="linkclass" href="<%=application.getContextPath() %>/editEnq/setSrchEnq.do?refNo=<%=enqlist.get(i).refNo%>" > <span style="color: red;"><%=enqlist.get(i).refNo%></span></a> </td>
            <td align="center" valign="top" bgcolor="#FFFFFF">
                <input type="checkbox" <%if(enqlist.get(i).isEnq==true){%> checked="checked" <%}%> name="enqcheck" id="enqcheck" />
            </td>
            <td align="center" valign="top" bgcolor="#FFFFFF"><input type="checkbox" <%if(enqlist.get(i).isQuo==true){%> checked="checked" <%}%> name="quotcheck" id="quotcheck" /></td>
            <td align="center" valign="top" bgcolor="#FFFFFF"><input type="checkbox" <%if(enqlist.get(i).isPO==true){%> checked="checked" <%}%> name="pocheck" id="pocheck" /></td>
            <td align="center" valign="top" bgcolor="#FFFFFF"><input type="checkbox"  <%if(enqlist.get(i).isInvoice==true){%> checked="checked" <%}%> name="invoicecheck" id="invoicecheck" /></td>
          </tr>
          <%}
	      	}%>
          <tr>
            <td align="center" bgcolor="#FFFFFF">2</td>
            <td align="left" valign="top" bgcolor="#FFFFFF">KK/CP/1/13-04-2012</td>
            <td align="center" valign="top" bgcolor="#FFFFFF"><form id="form3" name="form3" method="post" action="">
              <label>
                <input type="checkbox" name="checkbox2" id="checkbox2" />
                </label>
            </form>
            </td>
            <td align="center" valign="top" bgcolor="#FFFFFF"><input type="checkbox" name="checkbox4" id="checkbox4" /></td>
            <td align="center" valign="top" bgcolor="#FFFFFF"><input type="checkbox" name="checkbox6" id="checkbox6" /></td>
            <td align="center" valign="top" bgcolor="#FFFFFF"><input type="checkbox" name="checkbox8" id="checkbox8" /></td>
          </tr>
          <tr>
            <td bgcolor="#FFFFFF">&nbsp;</td>
            <td align="left" valign="top" bgcolor="#FFFFFF">&nbsp;</td>
            <td align="left" valign="top" bgcolor="#FFFFFF">&nbsp;</td>
            <td align="left" valign="top" bgcolor="#FFFFFF">&nbsp;</td>
            <td align="left" valign="top" bgcolor="#FFFFFF">&nbsp;</td>
            <td align="left" valign="top" bgcolor="#FFFFFF">&nbsp;</td>
          </tr>
    
        </table>
      </div> --%>
	  <div class="box2">
	  <div id="enqSrchTable"></div>
	   
	
	  <div id="searchByPartLoader" style="display:none" align="center"><img src="<%=application.getContextPath()%>/images/loading.gif"/></div>
    </div>
    </div> 
    <!-- InstanceEndEditable -->
  </div><div id="footer"></div>  
</div>
</body>
<!-- InstanceEnd --></html>
 <script type="text/javascript">
   function getSearchPart(){
	  var mnth= $("#month").val();
	  var year= $("#year").val();
	  var partid= $("#partid").val();
	 //var data="mnth="+mnth+"&year="+year;
	 var data="partname="+partid+"&mnth="+mnth+"&year="+year;
	  //alert(data);
	  $("#searchByPartLoader").show();
	  $.ajax({
			url: "<%= application.getContextPath()%>/search/getByPart.do", 
			mimetype: "text/html",
			method: "post",
			data: data,
			cache:false,
			success: function(res){
				$("#enqSrchTable").html(res);
			}

		}).done(function(html){
			$("#searchByPartLoader").hide();
		  }).fail(function(html){
		  	$("#searchByPartLoader").hide();
		  	alert("Failed To Load the Data");
		  });
   }
</script>

